package tests;

import general.Personne;

import java.util.List;

import org.hibernate.Session;

import util.HibernateUtil;

public class Manager{	
	public Manager(){	
	}
		
	@SuppressWarnings("unchecked")
	public List<Personne> listRelationsDirects(Long personId) {		
	    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
	    session.beginTransaction();
	    List<Personne> result=session.createQuery("select p from Personne p " +
	    		"INNER JOIN p.relationsDirectes where p.id = :pid").setParameter("pid", personId).list();	    
	    session.getTransaction().commit();
	    return result;
	}
}
